/**
 * 
 */
package com.nars.charactersets;

import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;

/**
 * @author Student
 * 
 */

// file.encoding - property for java executable
public class CharacterSetDemo {

	/**
	 * @param args
	 * @throws UnsupportedEncodingException 
	 */
	public static void main(String[] args) throws UnsupportedEncodingException {
		Charset.forName("UTF32");
		System.out.println(Charset.defaultCharset());
		System.out.println(Charset.forName("UTF8"));
		System.out.println(Charset.isSupported("UTF8"));
		System.out.println(Charset.availableCharsets());
		Charset.isSupported("UTF8");
		System.out.println("Convertion " + "FUCK".getBytes());

		String string1 = new String(new byte[] { -58 },
				Charset.forName("Windows-1251"));
		System.out.println("Convertion windows: " + string1);
		String string2 = new String(new byte[] { -58 }, Charset.forName("UTF8"));
		System.out.println("Convertion windows: " + string2);

		String str = "Venelin Petkov <-> Венелин Петков";

		System.out.println(str);
		byte[] encoded = str.getBytes("ascii");
		byte[] encoded2 = str.getBytes("UTF8");
		String decoded = new String(encoded, "ascii");
		String decoded2 = new String(encoded2, "UTF8");
		System.out.printf(decoded);
		System.out.println();
		System.out.printf(decoded2);

	}

}

